package com.fnzx.controller;

import java.util.Arrays;
import java.util.Map;

import com.fnzx.entity.LinkOtherEntity;
import com.fnzx.service.LinkOtherService;
import com.fnzx.util.PageUtils;
import com.fnzx.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * 
 *
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2021-11-08 13:46:06
 */
@RestController
@RequestMapping("iot/linkother")
public class LinkOtherController {
    @Autowired
    private LinkOtherService linkOtherService;

    /**
     * 列表
     */
    @GetMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = linkOtherService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @GetMapping("/info/{id}")
    public R info(@PathVariable("id") Long id){
		LinkOtherEntity linkOther = linkOtherService.getById(id);

        return R.ok().put("linkOther", linkOther);
    }

    /**
     * 保存
     */
    @PostMapping("/save")
    public R save(@RequestBody LinkOtherEntity linkOther){
		linkOtherService.save(linkOther);

        return R.ok();
    }

    /**
     * 修改
     */
    @PostMapping("/update")
    public R update(@RequestBody LinkOtherEntity linkOther){
		linkOtherService.updateById(linkOther);

        return R.ok();
    }

    /**
     * 删除
     */
    @PostMapping("/delete")
    public R delete(@RequestBody Long[] ids){
		linkOtherService.removeByIds(Arrays.asList(ids));
        return R.ok();
    }

}
